< previous page page_167 next page >

Page 167
e10a6a0a59f035e870d90cca05b85fce.gif
frmPlanet.Icon = LoadPicture("C:\Images\Planet.ico")
To clear the graphic displayed in a form, image, or picture box, use LoadPicture with no parameters.
e10a6a0a59f035e870d90cca05b85fce.gif
frmPlanet.Picture = LoadPicture()
Table 6.1 lists file formats that LoadPicture understands. While these are all standard file formats, you may run into some variations. For example, a wmf file can come with or without a placeable header. LoadPicture can load a wmf file that has a placeable header, but it cannot load one without this header. The easiest way to determine if you can load a particular file is to give it a try. Use the On Error GoTo statement to protect your program when LoadPicture fails.
LoadPicture may also fail to load some kinds of truncated files. If you incompletely download a JPEG file from the Internet, LoadPicture may get stuck reading the file and never stop. If LoadPicture does not finish, your program cannot protect itself using an On Error GoTo statement.
Unfortunately, the LoadPicture function cannot load other graphic file formats, such as tif and pcx files. Several commercially available controls can read files stored in these formats. You may also be able to find some shareware or freeware file conversion utilities on the Web.
LoadImage
After you have loaded a picture using the LoadPicture method, you can use PaintPicture to shrink or stretch the image. PaintPicture enlarges an image by repeating each of the pixels in the input picture several times in the output picture. This can give the result a blocky appearance. When PaintPicture shrinks an image, it removes some of the pixels in the image, which can cause unsightly gaps or artificial jaggedness in the result.
Both of these effects are caused by aliasing, a topic covered in more detail in Chapter 7. For now, it is enough to know that resizing an image using PaintPicture can cause these effects.
Table 6.1 Image File Formats That LoadPicture Understands
FILE FORMATEXTENSION
Bitmapbmp
Iconico
Cursorcur
Run-length encoded bitmaprle
Windows metafilewmf
Enhanced metafileemf
GIF (Graphics Interchange Format)gif
JPEG (Joint Photographic Experts Group)jpg, jpeg

 
< previous page page_167 next page >